#ifndef PROCESSSTART_H
#define PROCESSSTART_H

#include "processstart_global.h"
#include <QObject>
#include <QProcess>
#include <QThread>
#include <QMutexLocker>
#ifdef Q_OS_WIN
#include <windows.h>
#endif


class PROCESSSTARTSHARED_EXPORT ProcessStart : public QObject
{
    Q_OBJECT
public:
    explicit ProcessStart(QObject *parent = nullptr);
    //Must be Set.
    void setRunModel(bool value);
    void setArgument(QStringList  value);
    void setProgramName(QString  value);
    void setPath(QString  value);

    void initial();


    void start(bool admin);

private:
    void adminStart();

signals:
    void finished(int data);

    void stateChanged(QProcess::ProcessState newState);
    void msg_News(QByteArray data);

public slots:
    void StartScript();
    void printError(QProcess::ProcessError error);

private:
    QProcess *onePro;
    QStringList  argument;
    QString program;
    QString path;


    bool model;
    mutable QMutex mutex;
};


#endif // PROCESSSTART_H
